@@ -31,6 +31,8 @@ public class PhotoBean implements Serializable{ |
||
31 | 31 |
|
32 | 32 |
public boolean isRawPhoto; |
33 | 33 |
|
34 |
+ public String lensmanType; |
|
35 |
+ |
|
34 | 36 |
@Override |
35 | 37 |
public boolean equals(Object obj) { |
36 | 38 |
if(obj == this){ |
@@ -7,7 +7,7 @@ import android.database.sqlite.SQLiteOpenHelper; |
||
7 | 7 |
public class DBHelper extends SQLiteOpenHelper{ |
8 | 8 |
|
9 | 9 |
private static final String DB_NAME = "paiai"; |
10 |
- private static final int DB_VERSION = 3; |
|
10 |
+ private static final int DB_VERSION = 4; |
|
11 | 11 |
private static DBHelper instance; |
12 | 12 |
|
13 | 13 |
public static final String PHOTO_INFO_TABLE = "photo_info_table"; |
@@ -25,6 +25,7 @@ public class DBHelper extends SQLiteOpenHelper{ |
||
25 | 25 |
String UPLOADED_STATUS = "upload_status"; |
26 | 26 |
String GROUP_ID = "group_id"; |
27 | 27 |
String SESSION_CREATE_TIME = "session_create_time"; |
28 |
+ String LENSMAN_TYPE = "lensman_type"; |
|
28 | 29 |
|
29 | 30 |
} |
30 | 31 |
|
@@ -51,6 +52,8 @@ public class DBHelper extends SQLiteOpenHelper{ |
||
51 | 52 |
upgradeToVersion2(db); |
52 | 53 |
case 2: |
53 | 54 |
upgradeToVersion3(db); |
55 |
+ case 3: |
|
56 |
+ upgradeToVersion4(db); |
|
54 | 57 |
break; |
55 | 58 |
default: |
56 | 59 |
dropAndRecreateTables(db); |
@@ -66,6 +69,10 @@ public class DBHelper extends SQLiteOpenHelper{ |
||
66 | 69 |
db.execSQL("Alter table "+ PHOTO_INFO_TABLE+" add column "+PHOTO_INFO_COLUMNS.SESSION_CREATE_TIME +" LONG"); |
67 | 70 |
} |
68 | 71 |
|
72 |
+ private void upgradeToVersion4(SQLiteDatabase db){ |
|
73 |
+ db.execSQL("Alter table "+ PHOTO_INFO_TABLE+" add column "+PHOTO_INFO_COLUMNS.LENSMAN_TYPE +" VARCHAR"); |
|
74 |
+ } |
|
75 |
+ |
|
69 | 76 |
private void dropAndRecreateTables(SQLiteDatabase db){ |
70 | 77 |
db.execSQL("DROP TABLE IF EXISTS " + PHOTO_INFO_TABLE); |
71 | 78 |
createTables(db); |
@@ -84,6 +91,7 @@ public class DBHelper extends SQLiteOpenHelper{ |
||
84 | 91 |
sql.append(PHOTO_INFO_COLUMNS.PHOTO_PATH).append(" VARCHAR, "); |
85 | 92 |
sql.append(PHOTO_INFO_COLUMNS.LENSMAN_ID).append(" VARCHAR, "); |
86 | 93 |
sql.append(PHOTO_INFO_COLUMNS.SESSION_ID).append(" VARCHAR, "); |
94 |
+ sql.append(PHOTO_INFO_COLUMNS.LENSMAN_TYPE).append(" VARCHAR, "); |
|
87 | 95 |
sql.append(PHOTO_INFO_COLUMNS.GROUP_ID).append(" VARCHAR, "); |
88 | 96 |
sql.append(PHOTO_INFO_COLUMNS.IS_RAW_PHOTO).append(" INTEGER, "); |
89 | 97 |
sql.append(PHOTO_INFO_COLUMNS.SESSION_SEQ).append(" INTEGER, "); |
@@ -80,6 +80,7 @@ public class DBService { |
||
80 | 80 |
item.sessionDate = c.getLong(c.getColumnIndex(DBHelper.PHOTO_INFO_COLUMNS.SESSION_DATE)); |
81 | 81 |
item.sessionSeq = c.getInt(c.getColumnIndex(DBHelper.PHOTO_INFO_COLUMNS.SESSION_SEQ)); |
82 | 82 |
item.sessionCreateTime = c.getLong(c.getColumnIndex(DBHelper.PHOTO_INFO_COLUMNS.SESSION_CREATE_TIME)); |
83 |
+ item.lensmanType = c.getString(c.getColumnIndex(DBHelper.PHOTO_INFO_COLUMNS.LENSMAN_TYPE)); |
|
83 | 84 |
return item; |
84 | 85 |
} |
85 | 86 |
|
@@ -97,6 +98,7 @@ public class DBService { |
||
97 | 98 |
cv.put(DBHelper.PHOTO_INFO_COLUMNS.SESSION_DATE,item.sessionDate); |
98 | 99 |
cv.put(DBHelper.PHOTO_INFO_COLUMNS.SESSION_SEQ,item.sessionSeq); |
99 | 100 |
cv.put(DBHelper.PHOTO_INFO_COLUMNS.SESSION_CREATE_TIME,item.sessionCreateTime); |
101 |
+ cv.put(DBHelper.PHOTO_INFO_COLUMNS.LENSMAN_TYPE,item.lensmanType); |
|
100 | 102 |
return cv; |
101 | 103 |
} |
102 | 104 |
|
@@ -49,6 +49,13 @@ public class Preferences { |
||
49 | 49 |
return mPrefs.getString("lensManId",BuildConfig.isJumpLogin?"Cwi7HSh":NullStr); |
50 | 50 |
} |
51 | 51 |
|
52 |
+ public void setLensManType(String lensManType){ |
|
53 |
+ mPrefs.edit().putString("lensManType",lensManType).commit(); |
|
54 |
+ } |
|
55 |
+ |
|
56 |
+ public String getLensManType(){ |
|
57 |
+ return mPrefs.getString("lensManType",NullStr); |
|
58 |
+ } |
|
52 | 59 |
|
53 | 60 |
public void setCameraLibVersion(int version){ |
54 | 61 |
mPrefs.edit().putInt("cameraLibVer",version).commit(); |
@@ -113,7 +113,8 @@ public class LoginActivity extends FragmentActivity implements LoginContract.Vie |
||
113 | 113 |
JSONObject jsonObject = new JSONObject(json); |
114 | 114 |
String unionid = jsonObject.getString("unionid"); |
115 | 115 |
String token = jsonObject.getString("token"); |
116 |
- presenter.login(unionid,token); |
|
116 |
+ String lensmanType = jsonObject.getString("lensman_type"); |
|
117 |
+ presenter.login(unionid,token,lensmanType); |
|
117 | 118 |
return; |
118 | 119 |
}catch (Exception e){ |
119 | 120 |
LogHelper.e("czy","login deal qrcode error"+e); |
@@ -14,7 +14,7 @@ public class LoginContract { |
||
14 | 14 |
} |
15 | 15 |
|
16 | 16 |
interface Presenter extends BasePresenter{ |
17 |
- void login(String unionid, String token); |
|
17 |
+ void login(String unionid, String token,String lensmanType); |
|
18 | 18 |
} |
19 | 19 |
|
20 | 20 |
} |
@@ -14,17 +14,19 @@ public class LoginPresenter implements LoginContract.Presenter,BaseInteractor.In |
||
14 | 14 |
|
15 | 15 |
private LoginContract.View view; |
16 | 16 |
private LoginInteractor interactor; |
17 |
+ private String lensmanType; |
|
17 | 18 |
|
18 | 19 |
public LoginPresenter(LoginContract.View view){ |
19 | 20 |
this.view = view; |
20 | 21 |
} |
21 | 22 |
|
22 | 23 |
@Override |
23 |
- public void login(String unionid, String token) { |
|
24 |
+ public void login(String unionid, String token,String lensmanType) { |
|
24 | 25 |
LogHelper.d("czy","presenter login"); |
25 | 26 |
view.showProgressView(); |
26 | 27 |
interactor = new LoginInteractor(unionid,token,this); |
27 | 28 |
interactor.startJob(); |
29 |
+ this.lensmanType = lensmanType; |
|
28 | 30 |
} |
29 | 31 |
|
30 | 32 |
@Override |
@@ -45,6 +47,7 @@ public class LoginPresenter implements LoginContract.Presenter,BaseInteractor.In |
||
45 | 47 |
view.hideProgressView(); |
46 | 48 |
view.showLoginHint(App.getAppContext().getString(R.string.login_success)); |
47 | 49 |
Preferences.getInstance().setLensManId(result); |
50 |
+ Preferences.getInstance().setLensManType(lensmanType); |
|
48 | 51 |
view.jumpMain(); |
49 | 52 |
} |
50 | 53 |
|
@@ -40,7 +40,7 @@ public class UploadTask extends AsyncTask<Void, Integer, Boolean> { |
||
40 | 40 |
} |
41 | 41 |
photoUploadUtils.addTextParameter("photo_id", String.valueOf(bean.photoId)); |
42 | 42 |
photoUploadUtils.addTextParameter("nickname",Preferences.getInstance().getUserName()); |
43 |
- |
|
43 |
+ photoUploadUtils.addTextParameter("lensman_type",bean.lensmanType); |
|
44 | 44 |
String result = new String(photoUploadUtils.send(), "UTF-8"); |
45 | 45 |
JSONObject resultObj = new JSONObject(result); |
46 | 46 |
if (resultObj.getInt("status") == 200) { |
@@ -15,6 +15,7 @@ import java.io.File; |
||
15 | 15 |
import ai.pai.lensman.App; |
16 | 16 |
import ai.pai.lensman.bean.PhotoBean; |
17 | 17 |
import ai.pai.lensman.bean.SessionBean; |
18 |
+import ai.pai.lensman.db.Preferences; |
|
18 | 19 |
import ai.pai.lensman.dslr.CameraService; |
19 | 20 |
import ai.pai.lensman.service.Constants; |
20 | 21 |
|
@@ -145,6 +146,7 @@ public class SessionInteractor implements Callback{ |
||
145 | 146 |
bean.sessionDate = sessionBean.sessionDate; |
146 | 147 |
bean.sessionCreateTime = sessionBean.createTime; |
147 | 148 |
bean.photoPath = sessionWorkingDirPath+File.separator+eventMsg; |
149 |
+ bean.lensmanType = Preferences.getInstance().getLensManType(); |
|
148 | 150 |
listener.onSessionPhotoCaptured(bean); |
149 | 151 |
LogHelper.d("czy","手机收到新照片 "+ bean); |
150 | 152 |
} |
@@ -57,6 +57,7 @@ public class SettingsActivity extends BaseActivity { |
||
57 | 57 |
@OnClick(R.id.btn_user_logout) |
58 | 58 |
void logout(){ |
59 | 59 |
Preferences.getInstance().setLensManId(""); |
60 |
+ Preferences.getInstance().setLensManType(""); |
|
60 | 61 |
Intent intent = new Intent(this, LoginActivity.class); |
61 | 62 |
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); |
62 | 63 |
startActivity(intent); |